package data

import (
	"context"
	pb "go_private_im/api/comet"
	"strconv"
)

//通知用户加入房间
func (l *LogicRepo) NotifyUserAddRoom(ctx context.Context,server string,keys []string,Room string) (err error) {
	client :=  l.CometServers[server]
	op,_ := strconv.Atoi(Room)
	_,err = client.AddRoom(ctx,&pb.AddRoomReq{RoomId: Room,Keys: keys,ProtoOp: int32(op)})
	return
}

func (l *LogicRepo) UserOutRoom(ctx context.Context,server string,keys []string,Room string) (err error) {
	client :=  l.CometServers[server]
	op,_ := strconv.Atoi(Room)
	_,err = client.OutRoom(ctx,&pb.OutRoomReq{RoomId: Room,ProtoOp: int32(op),Keys: keys})
	return
}